<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <form>
        用户名<input type="text" name="account" id="account">
        密 码：<input type="password" name="password" id="password">
        <input type="submit" value="登录" id="submit">
    </form>
</body>
<script>
    window.onload=()=>{
        document.querySelector('#submit').onclick=()=>{
            let accout=document.querySelector('#account').value;
            let password=document.querySelector('#password').value;
            const xhr=new XMLHttpRequest()||new ActiveXObject();
            // xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
            xhr.open('post','/userLogin');
            xhr.send(`'accout='${accout}&password=${password}`);
            xhr.onreadystatechange = function () {
            if (xhr.readyState==4 &&xhr.status==200) {
            //步骤五 如果能够进到这个判断 说明 数据 完美的回来了,并且请求的页面是存在的
　　　　    console.log(xml.responseText);//输入相应的内容
  　　}
}
        }
    }
</script>
</html>